#ifndef __BOARD_CONF_H__
#define __BOARD_CONF_H__
#include "Service.h"

/**
* Creates services out of JSON configuration messages.
* Initializes services and registeres in MessageRouter and Main Container
*/

class IArduino;
class IEthernet;
class BoardAssembly;
class ServiceFactory;

class BoardConf : public Service{
public:
	BoardConf(IArduino& a, MessageRouter& router, ServiceFactory& factory, const String& name, ILogger& logger);
	virtual bool onItem(const String& name, const String& value);
	enum State{
		READY,
		BOARD_NAME_READ,
		DATA_READ};
		State _state;
	virtual bool isInfrastructure() const;
protected:
	void createService();
	void removeService(const String&);
	void removeAll();
private:
	MessageRouter& _router;
	IArduino& _arduino;
	ServiceFactory& _factory;
	String _serviceType;
	String _serviceName;
	int _pin;
	String _buttonTrigger;
	String _montionTrigger;
	String _lightCircuit;
	String _command;
};

#endif